#!/bin/bash
passwords=("P@ssw0rd123@" "Gd!By@way#0828" "gdbyway@123")  
ip_file="servers.txt"
output_file="ip_pwd.txt"

while IFS= read -r server; do
     echo "---------$server------------"
    for password in "${passwords[@]}"; do
        if sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=2 "$server" exit >/dev/null 2>&1; then
            echo "IP: $server，密码: $password" >> "$output_file"
            break
        fi
    done
done < "$ip_file"
